package net.zjitc.dao;

import net.zjitc.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserDao {
    @Insert("INSERT INTO users(username, age) VALUES(#{username}, #{age})")
    void save(User user);
    @Delete("DELETE FROM users WHERE id = #{id}")
    void delete(Integer id);
    @Update("UPDATE users SET username = #{username}, age = #{age} WHERE id = #{id}")
    void update(User user);
    @Select("SELECT * FROM users")
    List<User> findAll();
    @Select("SELECT * FROM users WHERE id = #{id}")
    User findById(Integer id);
}
